﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebTest
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected override void Render(HtmlTextWriter writer)
        {
            //StringBuilder sb = new StringBuilder();
            //StringWriter sw = new StringWriter(sb);
            //HtmlTextWriter hWriter = new HtmlTextWriter(sw);
            //base.Render(hWriter);

            //// *** store to a string
            //string PageResult = sb.ToString();

            ////
            //HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
            //doc.LoadHtml(PageResult);

            //var findclasses = doc.DocumentNode.Descendants().Where(d => d.Attributes.Contains("class") &&
            //    d.Attributes["class"].Value.Split(' ').Any(b => b.Equals("unoCss"))).ToList();
            //if (findclasses != null)
            //{
            //    for (int i = 0; i < findclasses.Count(); i++)
            //    {
            //        findclasses[i].Remove();
            //    }
            //}

            ////
            ////HtmlAgilityPack.HtmlNode m_unoNode = doc.GetElementbyId("uno");
            ////if (m_unoNode != null)
            ////{
            ////    m_unoNode.Remove(); // .SetAttributeValue("class", "display:none");
            ////}

            //string m_pageMod = doc.DocumentNode.OuterHtml;

            //var sw2 = new StringWriter();
            //doc.Save(sw2);
            //var s = sw2.ToString();

            //// *** Write it back to the server
            //writer.Write(m_pageMod);
        }
    }
}